echo ""
echo "Installing ISO-Server:"
echo "====================="
echo ""
echo ""
echo ""
echo "[*] Checking for Python..."
which python >/dev/null
if [ $? == 0 ]
then
	mkdir -p /opt/isoserver
	cp iso-server.py /opt/isoserver/
	chmod +x /opt/isoserver/iso-server.py
	cp iso-server /etc/init.d/
	chmod +x /etc/init.d/iso-server
	configFile=/opt/isoserver/iso-server.config
	if [ ! -f "$configFile" ]
	then
		echo "Creating config file at $configFile." 
		echo '#######################################################################################################' >"$configFile"
		echo '## ISO-Server Configuration file' >>"$configFile"
		echo '##' >>"$configFile"
		echo '## By Josiah Kerley (JosiahKerley@gmail.com)' >>"$configFile"
		echo '##' >>"$configFile"
		echo '## Be careful of trailing spaces!' >>"$configFile"
		echo '#######################################################################################################' >>"$configFile"
		echo '' >>"$configFile"
		echo 'source=/home,/root# This CSV will be where the service looks for *.iso files' >>"$configFile"
		echo 'recurs=True# Allows you to search for ISOs in whole subdirectory' >>"$configFile"
		echo 'target=/media/mounted-isos,/var/public-share# This CSV will be where the service mounts the *.iso files' >>"$configFile"
		echo 'mkdirt=True# Allows you to create destination folder if it does not exist' >>"$configFile"
		echo 'srfreq=120# Set the frequency to look for newly added *.iso files.' >>"$configFile"
	fi
	chown -R root /opt/isoserver
	sleep 2
	echo ""
	echo "Current configuration:"
	echo "======================"
	echo ""
	echo ""
	echo ""
	cat "$configFile"
	echo ""
	echo ""
	sleep 3
else
	echo "[!] Missing Python!"
	echo "[*] Aborting installation..."
fi